﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="ProductCategory.aspx.cs" Inherits="VINETLIFE.AdminCP.ProductCategory" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        <asp:Literal runat="server" ID="ltrAction"></asp:Literal></h2>
    <div runat="server" id="divDanhMuc">
        <table class="tablet">
            <tr>
                <td>
                    Tên danh mục sản phẩm
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtProductCategoryTitle" Width="300px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                        ForeColor="Red" ControlToValidate="txtProductCategoryTitle" ValidationGroup="vlCate"></asp:RequiredFieldValidator>
                </td>
                <td>
                    Mã danh mục sản phẩm
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtProductCategoryCode" Width="150px"></asp:TextBox>
                    <asp:RequiredFieldValidator Enabled="false" ID="RequiredFieldValidator2" runat="server"
                        ErrorMessage="*" ForeColor="Red" ControlToValidate="txtProductCategoryCode" ValidationGroup="vlCate"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Danh mục cấp trên
                </td>
                <td>
                    <asp:DropDownList runat="server" ID="ddlParentCate" AppendDataBoundItems="true" CssClass="ddl-input" Width="250px">
                        <asp:ListItem Text=".: Danh mục cao nhất :." Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    &nbsp;&nbsp;&nbsp;&nbsp; Thuộc trang chủ
                    <asp:CheckBox runat="server" ID="cbIsHomePage" />
                </td>
                <td>
                    Số thứ tự
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtOrderID" Width="100px" Text="0"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ErrorMessage="*"
                        ForeColor="Red" ControlToValidate="txtOrderID" ValidationGroup="vlCate"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Nhập số" ControlToValidate="txtOrderID"
                        Type="Integer" MinimumValue="0" MaximumValue="100" ValidationGroup="vlCate"></asp:RangeValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Miêu tả
                </td>
                <td colspan="3">
                    <asp:TextBox runat="server" ID="txtDescription" Width="100%" Height="60px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    Chi tiết
                </td>
                <td colspan="3">
                    <CKEditor:CKEditorControl ID="txtContents" runat="server"></CKEditor:CKEditorControl>
                </td>
            </tr>
            <tr>
                <td style="width: 150px;">
                    MetaDes<br />
                    Độ dài: 70~160 ký tự
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtMetaDes" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    MetaTag
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtMetaTag" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    PageTitle
                    <br />
                    Độ dài: 10~70 ký tự
                </td>
                <td>
                    <asp:TextBox runat="server" ID="txtpagsTitle" Width="99%" Height="50px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td colspan="3">
                    <asp:Button runat="server" ID="btnLuuDanhMuc" Text="Lưu danh mục" CssClass="button-gg-green"
                        ValidationGroup="vlCate" OnClick="btnLuuDanhMuc_Click" />
                    <a href="ListProductCategory.aspx" class="button-gg-green">Về trang Danh sách danh mục</a>
                </td>
            </tr>
        </table>
    </div>
    <div runat="server" id="divThuocTinh" class="div-property">
        <h2>
            Thuộc tính của danh mục sản phẩm</h2>
        <div style="float: right; width: 100%;">
            <span style="float: right">
                <asp:Button runat="server" ID="btnAddNewRecord" Text="Thêm bản ghi thuộc tính" CssClass="button-gg-green"
                    OnClick="AddNewRecord" /></span>
        </div>
        <asp:GridView ID="grvProperties" DataKeyNames="PropertyID" runat="server" AutoGenerateColumns="False"
            CssClass="tstyle2" PageSize="35" AllowPaging="true" Width="100%" PagerStyle-CssClass="pgr"
            OnRowCancelingEdit="grvProperties_RowCancelingEdit" OnRowEditing="grvProperties_RowEditing"
            OnRowUpdating="grvProperties_RowUpdating" OnRowCommand="grvProperties_RowCommand"
            OnRowDeleting="grvProperties_RowDeleting">
            <Columns>
                <asp:TemplateField HeaderText="PropertyID" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPropertyID" Text='<%#Eval("PropertyID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã thuộc tính" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPropertyCode" Text='<%#Eval("PropertyCode") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox runat="server" ID="txtPropertyCode" Text='<%#Eval("PropertyCode") %>'
                            Width="70px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtPropertyCode" ValidationGroup="vlProperty"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox runat="server" ID="txtFPropertyCode" Text="" Width="70px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator34" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtFPropertyCode" ValidationGroup="vlfProperty"></asp:RequiredFieldValidator>
                    </FooterTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên thuộc tính" ItemStyle-Width="30%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPropertyName" Text='<%#Eval("PropertyName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox runat="server" ID="txtPropertyName" Text='<%#Eval("PropertyName") %>'
                            Width="150px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4a" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtPropertyName" ValidationGroup="vlProperty"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox runat="server" ID="txtFPropertyName" Text="" Width="150px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatora4" runat="server" ErrorMessage="*"
                            ForeColor="Red" ControlToValidate="txtFPropertyName" ValidationGroup="vlfProperty"></asp:RequiredFieldValidator>
                    </FooterTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Kiểu dữ liệu" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblPropertyType" Text='<%#Eval("PropertyType") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList runat="server" ID="ddlPropertyType" DataSource='<%#VINETLIFE.AdminCP.Functions.DataType()%>'
                            DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:DropDownList runat="server" ID="ddlfPropertyType" DataSource='<%#VINETLIFE.AdminCP.Functions.DataType()%>'
                            DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                        </asp:DropDownList>
                    </FooterTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Danh mục sản phẩm" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblProductCategoryTitle" Text='<%#Eval("ProductCategoryTitle") %>'></asp:Label>
                    </ItemTemplate>
                    <FooterTemplate>
                        <asp:Label runat="server" ID="lblfProductCategoryTitle" Text='<%#ProductCategoryTitle()%>'></asp:Label>
                    </FooterTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="true" HeaderText="Sửa thuộc tính" ItemStyle-Width="10%"
                    CausesValidation="false" />
                <asp:TemplateField HeaderText="Xóa bản ghi" ItemStyle-Width="10%">
                    <ItemTemplate>
                        <asp:ImageButton ID="btDelete" runat="server" CommandArgument='<%#Eval("PropertyID") %>'
                            CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                    </ItemTemplate>
                    <FooterTemplate>
                        <asp:Button ID="btnInsert" runat="Server" Text="Insert" CssClass="button" CommandName="Insert"
                            UseSubmitBehavior="False" ValidationGroup="vlfProperty" />
                        <asp:Button ID="btnCancel" runat="Server" Text="Cancel" CssClass="button" CommandName="Cancel"
                            UseSubmitBehavior="False" />
                    </FooterTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <h2>
                    Danh mục hiện tại chưa có bản ghi thuộc tính nào! Nhập thuộc tính cho danh mục sản
                    phẩm</h2>
                <table class="tablet">
                    <tr>
                        <td>
                            Mã thuộc tính
                            <asp:TextBox runat="server" ID="txtPropertyCode" Width="70px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                                ForeColor="Red" ControlToValidate="txtPropertyCode" ValidationGroup="vlEmpProperty"></asp:RequiredFieldValidator>
                        </td>
                        <td>
                            Tên thuộc tính
                            <asp:TextBox runat="server" ID="txtEmptyPropertyName" Width="150px"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" ErrorMessage="*"
                                ForeColor="Red" ControlToValidate="txtEmptyPropertyName" ValidationGroup="vlEmpProperty"></asp:RequiredFieldValidator>
                        </td>
                        <td>
                            Kiểu dữ liệu
                            <asp:DropDownList runat="server" ID="ddlEmpPropertyType" DataSource='<%#VINETLIFE.AdminCP.Functions.DataType()%>'
                                DataTextField="PropertyNameInput" DataValueField="PropertyTypeInput">
                            </asp:DropDownList>
                        </td>
                        <td>
                            Danh mục sản phẩm: <span style="color: #000; font-weight: bold;">
                                <%#ProductCategoryTitle()%>
                            </span>
                        </td>
                        <td>
                            <asp:Button ID="btnInsert" runat="Server" Text="Insert" CommandName="EmptyInsert"
                                ValidationGroup="vlEmpProperty" UseSubmitBehavior="False" CssClass="button" />
                        </td>
                    </tr>
                </table>
            </EmptyDataTemplate>
        </asp:GridView>
    </div>
</asp:Content>
